| Conditions | 1 |
| Paths | 1 |
| Total Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | var blocktrail = require('../'); // require('blocktrail-sdk') when trying example from in your own project |
||
| 17 | var getWallet = function() { |
||
| 18 | return client.createNewWallet({ |
||
| 19 | identifier: identifier, |
||
| 20 | passphrase: passphrase, |
||
| 21 | walletVersion: walletVersion, |
||
| 22 | keyIndex: 9999 |
||
| 23 | }) |
||
| 24 | .progress(function(p) { |
||
| 25 | console.log('progress', p); |
||
| 26 | }) |
||
| 27 | .then(function(r) { |
||
| 28 | return r[0]; |
||
| 29 | }, function(e) { |
||
| 30 | if (e.message.match(/already exists/)) { |
||
| 31 | return client.initWallet({ |
||
| 32 | identifier: identifier, |
||
| 33 | passphrase: passphrase |
||
| 34 | }); |
||
| 35 | } else { |
||
| 36 | throw e; |
||
| 37 | } |
||
| 38 | }); |
||
| 39 | }; |
||
| 40 | |||
| 64 |